<?php

namespace app\admin\controller\pms;

use app\common\controller\Backend;
use think\Db;

/**
 * 配置管理
 *
 * @icon fa fa-circle-o
 */
class Pmsconfig extends Backend
{
    
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    protected $layout = '';

    public function _initialize()
    {
        parent::_initialize();
    }
    
    /**
     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
     */




    /**
     * Selectpage搜索
     */
    public function selectpage()
    {
        $key = input('key', '');
        $config = get_addon_config('pms');
        $list = array();

        if ($key == 'pay_type')
        {
            array_push($list, array('id'=>'收房费', 'name'=>'收房费'));   
            array_push($list, array('id'=>'收押金', 'name'=>'收押金'));   
            array_push($list, array('id'=>'退押金', 'name'=>'退押金'));   
        }

        foreach($config[$key] as $key=>$item)
        {
            array_push($list, array('id'=>$item, 'name'=>$item));
        }

        return json(array(
            'list'=>$list,
            'total'=>count($list)
        ));
    }


}
